<?php
class Mf_user_accoutModel {
	static $_table = 'mf_user_accout';
	static $_pk = 'id';
	static $_db = null;

	static function db(){
		if(self::$_db)
			return self::$_db;
		
		self::$_db = DbLib::getDbStatic('',self::$_table,self::$_pk);
		return self::$_db;
	}
	
	public static function __callStatic($func, $arguments){
		return call_user_func_array(array(self::db(),$func), $arguments);
	}

	static function create($data){
		return self::db()->add( $data );
	}

	static function update($data,$table = '',$where){
		if( empty($table) ){
			$table = self::$_table;
		}
		return self::db()->update( $data, $table ,$where );
	}

	static function count($table='',$filed = '*', $where  = ''){
		if( empty($table) ){
			$table = self::$_table;
		}
		return self::db()->countTableTotal( $table,$filed, $where );
	}

	
	static function getAcceResoByAid($aid,$type = null){
		if($type)
			$where = " and type = $type";
	
		$sql = "select * from ".self::$_table." where aid = $aid $where";
		$rs = self::db()->getAll($sql);
		if(!$rs)
			return array();
	
		$rr = array();
		foreach($rs as $k=>$v){
			$rr[] = $v['id'];
		}
	
		return $rs;
	
	}

}